import React, {Component} from 'react';
import {inject, observer} from 'mobx-react';
import {toJS} from 'mobx';
import cssModules from 'react-css-modules';
import {Form, Row, Button, Select} from 'antd';
import {FormInput} from '../../component/FormItem';

import styles from './style.less';

@inject('DeviceStore')
@observer
@cssModules(styles)
class AddUnitContent extends Component {
  constructor(props) {
    super(props);
    this.store = this.props.DeviceStore;
  }

  render() {
    const {fields, handleFormChange, Option} = this.store;
    let scale = Math.ceil((140 / 600) * 24);
    const formItemLayout = {
      labelCol: {
        sm: {span: scale},
      },
      wrapperCol: {
        sm: {span: 24 - scale},
      },
    };

    return (
      <Form
        {...formItemLayout}
        className={styles['edit_wrap']}
        autoComplete="off">
        <Select>
          <Option value="1幢101">1幢101</Option>
          <Option value="1幢102">1幢102</Option>
          <Option value="1幢103">1幢103</Option>
        </Select>
        <FormInput
          {...fields}
          onChange={handleFormChange}
          placeholder={'请输入设备位置楼层,例如1层、-1层'}
          label={'所在位置'}
          disabled={false}
          name={'position'}
          rules={[{required: true, message: '必须填写内容!'}]}
        />
      </Form>
    );
  }
}

export default AddUnitContent;
